home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Freeware / Adobe AIR 1.5.1 / AdobeAIRInstaller.exe / setup.swf / scripts / mx / containers / Panel.as < prev    next >
Encoding:
Text File  |  2009-02-12  |  33.4 KB  |  970 lines

  1. package mx.containers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.Graphics;
  5.    import flash.events.Event;
  6.    import flash.events.MouseEvent;
  7.    import flash.geom.Rectangle;
  8.    import flash.text.TextLineMetrics;
  9.    import flash.utils.getQualifiedClassName;
  10.    import mx.automation.IAutomationObject;
  11.    import mx.containers.utilityClasses.BoxLayout;
  12.    import mx.containers.utilityClasses.CanvasLayout;
  13.    import mx.containers.utilityClasses.ConstraintColumn;
  14.    import mx.containers.utilityClasses.ConstraintRow;
  15.    import mx.containers.utilityClasses.IConstraintLayout;
  16.    import mx.containers.utilityClasses.Layout;
  17.    import mx.controls.Button;
  18.    import mx.core.Container;
  19.    import mx.core.ContainerLayout;
  20.    import mx.core.EdgeMetrics;
  21.    import mx.core.EventPriority;
  22.    import mx.core.FlexVersion;
  23.    import mx.core.IFlexDisplayObject;
  24.    import mx.core.IFlexModuleFactory;
  25.    import mx.core.IFontContextComponent;
  26.    import mx.core.IUIComponent;
  27.    import mx.core.IUITextField;
  28.    import mx.core.UIComponent;
  29.    import mx.core.UIComponentCachePolicy;
  30.    import mx.core.UITextField;
  31.    import mx.core.UITextFormat;
  32.    import mx.core.mx_internal;
  33.    import mx.effects.EffectManager;
  34.    import mx.events.CloseEvent;
  35.    import mx.styles.ISimpleStyleClient;
  36.    import mx.styles.IStyleClient;
  37.    import mx.styles.StyleProxy;
  38.    
  39.    use namespace mx_internal;
  40.    
  41.    public class Panel extends Container implements IConstraintLayout, IFontContextComponent
  42.    {
  43.       mx_internal static var createAccessibilityImplementation:Function;
  44.       
  45.       mx_internal static const VERSION:String = "3.0.0.0";
  46.       
  47.       private static const HEADER_PADDING:Number = 14;
  48.       
  49.       private static var _closeButtonStyleFilters:Object = {
  50.          "closeButtonUpSkin":"closeButtonUpSkin",
  51.          "closeButtonOverSkin":"closeButtonOverSkin",
  52.          "closeButtonDownSkin":"closeButtonDownSkin",
  53.          "closeButtonDisabledSkin":"closeButtonDisabledSkin",
  54.          "closeButtonSkin":"closeButtonSkin",
  55.          "repeatDelay":"repeatDelay",
  56.          "repeatInterval":"repeatInterval"
  57.       };
  58.       
  59.       private var layoutObject:Layout;
  60.       
  61.       private var _status:String = "";
  62.       
  63.       private var _titleChanged:Boolean = false;
  64.       
  65.       mx_internal var titleBarBackground:IFlexDisplayObject;
  66.       
  67.       private var regX:Number;
  68.       
  69.       private var regY:Number;
  70.       
  71.       private var _layout:String = "vertical";
  72.       
  73.       mx_internal var closeButton:Button;
  74.       
  75.       private var initializing:Boolean = true;
  76.       
  77.       private var _title:String = "";
  78.       
  79.       protected var titleTextField:IUITextField;
  80.       
  81.       private var _statusChanged:Boolean = false;
  82.       
  83.       private var autoSetRoundedCorners:Boolean;
  84.       
  85.       private var _titleIcon:Class;
  86.       
  87.       private var _constraintRows:Array;
  88.       
  89.       protected var controlBar:IUIComponent;
  90.       
  91.       mx_internal var titleIconObject:Object = null;
  92.       
  93.       protected var titleBar:UIComponent;
  94.       
  95.       private var panelViewMetrics:EdgeMetrics;
  96.       
  97.       private var _constraintColumns:Array;
  98.       
  99.       mx_internal var _showCloseButton:Boolean = false;
  100.       
  101.       private var checkedForAutoSetRoundedCorners:Boolean;
  102.       
  103.       private var _titleIconChanged:Boolean = false;
  104.       
  105.       protected var statusTextField:IUITextField;
  106.       
  107.       public function Panel()
  108.       {
  109.          _constraintColumns = [];
  110.          _constraintRows = [];
  111.          super();
  112.          addEventListener("resizeStart",EffectManager.mx_internal::eventHandler,false,EventPriority.EFFECT);
  113.          addEventListener("resizeEnd",EffectManager.mx_internal::eventHandler,false,EventPriority.EFFECT);
  114.          layoutObject = new BoxLayout();
  115.          layoutObject.target = this;
  116.          showInAutomationHierarchy = true;
  117.       }
  118.       
  119.       private function systemManager_mouseUpHandler(param1:MouseEvent) : void
  120.       {
  121.          if(!isNaN(regX))
  122.          {
  123.             stopDragging();
  124.          }
  125.       }
  126.       
  127.       mx_internal function getHeaderHeightProxy() : Number
  128.       {
  129.          return getHeaderHeight();
  130.       }
  131.       
  132.       override public function getChildIndex(param1:DisplayObject) : int
  133.       {
  134.          if(Boolean(controlBar) && param1 == controlBar)
  135.          {
  136.             return numChildren;
  137.          }
  138.          return super.getChildIndex(param1);
  139.       }
  140.       
  141.       mx_internal function get _controlBar() : IUIComponent
  142.       {
  143.          return controlBar;
  144.       }
  145.       
  146.       mx_internal function getTitleBar() : UIComponent
  147.       {
  148.          return titleBar;
  149.       }
  150.       
  151.       [Bindable("layoutChanged")]
  152.       public function get layout() : String
  153.       {
  154.          return _layout;
  155.       }
  156.       
  157.       override protected function createChildren() : void
  158.       {
  159.          var _loc1_:Class = null;
  160.          var _loc2_:IStyleClient = null;
  161.          var _loc3_:ISimpleStyleClient = null;
  162.          super.createChildren();
  163.          if(!titleBar)
  164.          {
  165.             titleBar = new UIComponent();
  166.             titleBar.visible = false;
  167.             titleBar.addEventListener(MouseEvent.MOUSE_DOWN,titleBar_mouseDownHandler);
  168.             rawChildren.addChild(titleBar);
  169.          }
  170.          if(!mx_internal::titleBarBackground)
  171.          {
  172.             _loc1_ = getStyle("titleBackgroundSkin");
  173.             if(_loc1_)
  174.             {
  175.                mx_internal::titleBarBackground = new _loc1_();
  176.                _loc2_ = mx_internal::titleBarBackground as IStyleClient;
  177.                if(_loc2_)
  178.                {
  179.                   _loc2_.setStyle("backgroundImage",undefined);
  180.                }
  181.                _loc3_ = mx_internal::titleBarBackground as ISimpleStyleClient;
  182.                if(_loc3_)
  183.                {
  184.                   _loc3_.styleName = this;
  185.                }
  186.                titleBar.addChild(DisplayObject(mx_internal::titleBarBackground));
  187.             }
  188.          }
  189.          mx_internal::createTitleTextField(-1);
  190.          mx_internal::createStatusTextField(-1);
  191.          if(!mx_internal::closeButton)
  192.          {
  193.             mx_internal::closeButton = new Button();
  194.             mx_internal::closeButton.styleName = new StyleProxy(this,closeButtonStyleFilters);
  195.             mx_internal::closeButton.mx_internal::upSkinName = "closeButtonUpSkin";
  196.             mx_internal::closeButton.mx_internal::overSkinName = "closeButtonOverSkin";
  197.             mx_internal::closeButton.mx_internal::downSkinName = "closeButtonDownSkin";
  198.             mx_internal::closeButton.mx_internal::disabledSkinName = "closeButtonDisabledSkin";
  199.             mx_internal::closeButton.mx_internal::skinName = "closeButtonSkin";
  200.             mx_internal::closeButton.explicitWidth = mx_internal::closeButton.explicitHeight = 16;
  201.             mx_internal::closeButton.focusEnabled = false;
  202.             mx_internal::closeButton.visible = false;
  203.             mx_internal::closeButton.enabled = enabled;
  204.             mx_internal::closeButton.addEventListener(MouseEvent.CLICK,closeButton_clickHandler);
  205.             titleBar.addChild(mx_internal::closeButton);
  206.             mx_internal::closeButton.owner = this;
  207.          }
  208.       }
  209.       
  210.       public function get constraintColumns() : Array
  211.       {
  212.          return _constraintColumns;
  213.       }
  214.       
  215.       override public function set cacheAsBitmap(param1:Boolean) : void
  216.       {
  217.          super.cacheAsBitmap = param1;
  218.          if(cacheAsBitmap && !mx_internal::contentPane && cachePolicy != UIComponentCachePolicy.OFF && getStyle("backgroundColor"))
  219.          {
  220.             mx_internal::createContentPane();
  221.             invalidateDisplayList();
  222.          }
  223.       }
  224.       
  225.       override public function createComponentsFromDescriptors(param1:Boolean = true) : void
  226.       {
  227.          var _loc3_:Object = null;
  228.          super.createComponentsFromDescriptors();
  229.          if(numChildren == 0)
  230.          {
  231.             setControlBar(null);
  232.             return;
  233.          }
  234.          var _loc2_:IUIComponent = IUIComponent(getChildAt(numChildren - 1));
  235.          if(_loc2_ is ControlBar)
  236.          {
  237.             _loc3_ = _loc2_.document;
  238.             if(mx_internal::contentPane)
  239.             {
  240.                mx_internal::contentPane.removeChild(DisplayObject(_loc2_));
  241.             }
  242.             else
  243.             {
  244.                removeChild(DisplayObject(_loc2_));
  245.             }
  246.             _loc2_.document = _loc3_;
  247.             rawChildren.addChild(DisplayObject(_loc2_));
  248.             setControlBar(_loc2_);
  249.          }
  250.          else
  251.          {
  252.             setControlBar(null);
  253.          }
  254.       }
  255.       
  256.       override protected function layoutChrome(param1:Number, param2:Number) : void
  257.       {
  258.          var _loc9_:Number = NaN;
  259.          var _loc10_:Graphics = null;
  260.          var _loc11_:Number = NaN;
  261.          var _loc12_:Number = NaN;
  262.          var _loc13_:Number = NaN;
  263.          var _loc14_:Number = NaN;
  264.          var _loc15_:Number = NaN;
  265.          var _loc16_:Number = NaN;
  266.          var _loc17_:Number = NaN;
  267.          var _loc18_:Number = NaN;
  268.          var _loc19_:Number = NaN;
  269.          var _loc20_:Number = NaN;
  270.          var _loc21_:Number = NaN;
  271.          super.layoutChrome(param1,param2);
  272.          var _loc3_:EdgeMetrics = EdgeMetrics.EMPTY;
  273.          var _loc4_:Number = getStyle("borderThickness");
  274.          if(getQualifiedClassName(mx_internal::border) == "mx.skins.halo::PanelSkin" && getStyle("borderStyle") != "default" && Boolean(_loc4_))
  275.          {
  276.             _loc3_ = new EdgeMetrics(_loc4_,_loc4_,_loc4_,_loc4_);
  277.          }
  278.          var _loc5_:EdgeMetrics = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : _loc3_;
  279.          var _loc6_:Number = _loc5_.left;
  280.          var _loc7_:Number = _loc5_.top;
  281.          var _loc8_:Number = getHeaderHeight();
  282.          if(_loc8_ > 0 && height >= _loc8_)
  283.          {
  284.             _loc9_ = param1 - _loc5_.left - _loc5_.right;
  285.             showTitleBar(true);
  286.             titleBar.mouseChildren = true;
  287.             titleBar.mouseEnabled = true;
  288.             _loc10_ = titleBar.graphics;
  289.             _loc10_.clear();
  290.             _loc10_.beginFill(16777215,0);
  291.             _loc10_.drawRect(0,0,_loc9_,_loc8_);
  292.             _loc10_.endFill();
  293.             titleBar.move(_loc6_,_loc7_);
  294.             titleBar.setActualSize(_loc9_,_loc8_);
  295.             mx_internal::titleBarBackground.move(0,0);
  296.             IFlexDisplayObject(mx_internal::titleBarBackground).setActualSize(_loc9_,_loc8_);
  297.             mx_internal::closeButton.visible = mx_internal::_showCloseButton;
  298.             if(mx_internal::_showCloseButton)
  299.             {
  300.                mx_internal::closeButton.setActualSize(mx_internal::closeButton.getExplicitOrMeasuredWidth(),mx_internal::closeButton.getExplicitOrMeasuredHeight());
  301.                mx_internal::closeButton.move(param1 - _loc6_ - _loc5_.right - 10 - mx_internal::closeButton.getExplicitOrMeasuredWidth(),(_loc8_ - mx_internal::closeButton.getExplicitOrMeasuredHeight()) / 2);
  302.             }
  303.             _loc11_ = 10;
  304.             _loc12_ = 10;
  305.             if(mx_internal::titleIconObject)
  306.             {
  307.                _loc13_ = Number(mx_internal::titleIconObject.height);
  308.                _loc14_ = (_loc8_ - _loc13_) / 2;
  309.                mx_internal::titleIconObject.move(_loc11_,_loc14_);
  310.                _loc11_ += mx_internal::titleIconObject.width + 4;
  311.             }
  312.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  313.             {
  314.                _loc13_ = titleTextField.nonZeroTextHeight;
  315.             }
  316.             else
  317.             {
  318.                _loc13_ = titleTextField.getUITextFormat().measureText(titleTextField.text).height;
  319.             }
  320.             _loc14_ = (_loc8_ - _loc13_) / 2;
  321.             _loc15_ = _loc5_.left + _loc5_.right;
  322.             titleTextField.move(_loc11_,_loc14_ - 1);
  323.             titleTextField.setActualSize(Math.max(0,param1 - _loc11_ - _loc12_ - _loc15_),_loc13_ + UITextField.mx_internal::TEXT_HEIGHT_PADDING);
  324.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  325.             {
  326.                _loc13_ = statusTextField.textHeight;
  327.             }
  328.             else
  329.             {
  330.                _loc13_ = statusTextField.text != "" ? statusTextField.getUITextFormat().measureText(statusTextField.text).height : 0;
  331.             }
  332.             _loc14_ = (_loc8_ - _loc13_) / 2;
  333.             _loc16_ = param1 - _loc12_ - 4 - _loc15_ - statusTextField.textWidth;
  334.             if(mx_internal::_showCloseButton)
  335.             {
  336.                _loc16_ -= mx_internal::closeButton.getExplicitOrMeasuredWidth() + 4;
  337.             }
  338.             statusTextField.move(_loc16_,_loc14_ - 1);
  339.             statusTextField.setActualSize(statusTextField.textWidth + 8,statusTextField.textHeight + UITextField.mx_internal::TEXT_HEIGHT_PADDING);
  340.             _loc17_ = titleTextField.x + titleTextField.textWidth + 8;
  341.             if(statusTextField.x < _loc17_)
  342.             {
  343.                statusTextField.width = Math.max(statusTextField.width - (_loc17_ - statusTextField.x),0);
  344.                statusTextField.x = _loc17_;
  345.             }
  346.          }
  347.          else if(titleBar)
  348.          {
  349.             showTitleBar(false);
  350.             titleBar.mouseChildren = false;
  351.             titleBar.mouseEnabled = false;
  352.          }
  353.          if(controlBar)
  354.          {
  355.             _loc18_ = Number(controlBar.x);
  356.             _loc19_ = Number(controlBar.y);
  357.             _loc20_ = Number(controlBar.width);
  358.             _loc21_ = Number(controlBar.height);
  359.             controlBar.setActualSize(param1 - (_loc5_.left + _loc5_.right),controlBar.getExplicitOrMeasuredHeight());
  360.             controlBar.move(_loc5_.left,param2 - _loc5_.bottom - controlBar.getExplicitOrMeasuredHeight());
  361.             if(controlBar.includeInLayout)
  362.             {
  363.                controlBar.visible = controlBar.y >= _loc5_.top;
  364.             }
  365.             if(_loc18_ != controlBar.x || _loc19_ != controlBar.y || _loc20_ != controlBar.width || _loc21_ != controlBar.height)
  366.             {
  367.                invalidateDisplayList();
  368.             }
  369.          }
  370.       }
  371.       
  372.       public function set layout(param1:String) : void
  373.       {
  374.          if(_layout != param1)
  375.          {
  376.             _layout = param1;
  377.             if(layoutObject)
  378.             {
  379.                layoutObject.target = null;
  380.             }
  381.             if(_layout == ContainerLayout.ABSOLUTE)
  382.             {
  383.                layoutObject = new CanvasLayout();
  384.             }
  385.             else
  386.             {
  387.                layoutObject = new BoxLayout();
  388.                if(_layout == ContainerLayout.VERTICAL)
  389.                {
  390.                   BoxLayout(layoutObject).direction = BoxDirection.VERTICAL;
  391.                }
  392.                else
  393.                {
  394.                   BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL;
  395.                }
  396.             }
  397.             if(layoutObject)
  398.             {
  399.                layoutObject.target = this;
  400.             }
  401.             invalidateSize();
  402.             invalidateDisplayList();
  403.             dispatchEvent(new Event("layoutChanged"));
  404.          }
  405.       }
  406.       
  407.       public function get constraintRows() : Array
  408.       {
  409.          return _constraintRows;
  410.       }
  411.       
  412.       [Bindable("titleChanged")]
  413.       public function get title() : String
  414.       {
  415.          return _title;
  416.       }
  417.       
  418.       mx_internal function getTitleTextField() : IUITextField
  419.       {
  420.          return titleTextField;
  421.       }
  422.       
  423.       mx_internal function createStatusTextField(param1:int) : void
  424.       {
  425.          var _loc2_:String = null;
  426.          if(Boolean(titleBar) && !statusTextField)
  427.          {
  428.             statusTextField = IUITextField(createInFontContext(UITextField));
  429.             statusTextField.selectable = false;
  430.             if(param1 == -1)
  431.             {
  432.                titleBar.addChild(DisplayObject(statusTextField));
  433.             }
  434.             else
  435.             {
  436.                titleBar.addChildAt(DisplayObject(statusTextField),param1);
  437.             }
  438.             _loc2_ = getStyle("statusStyleName");
  439.             statusTextField.styleName = _loc2_;
  440.             statusTextField.text = status;
  441.             statusTextField.enabled = enabled;
  442.          }
  443.       }
  444.       
  445.       public function get fontContext() : IFlexModuleFactory
  446.       {
  447.          return moduleFactory;
  448.       }
  449.       
  450.       override protected function measure() : void
  451.       {
  452.          var _loc6_:Number = NaN;
  453.          super.measure();
  454.          layoutObject.measure();
  455.          var _loc1_:Rectangle = measureHeaderText();
  456.          var _loc2_:Number = _loc1_.width;
  457.          var _loc3_:Number = _loc1_.height;
  458.          var _loc4_:EdgeMetrics = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : EdgeMetrics.EMPTY;
  459.          _loc2_ += _loc4_.left + _loc4_.right;
  460.          var _loc5_:Number = 5;
  461.          _loc2_ += _loc5_ * 2;
  462.          if(mx_internal::titleIconObject)
  463.          {
  464.             _loc2_ += mx_internal::titleIconObject.width;
  465.          }
  466.          if(mx_internal::closeButton)
  467.          {
  468.             _loc2_ += mx_internal::closeButton.getExplicitOrMeasuredWidth() + 6;
  469.          }
  470.          measuredMinWidth = Math.max(_loc2_,measuredMinWidth);
  471.          measuredWidth = Math.max(_loc2_,measuredWidth);
  472.          if(Boolean(controlBar) && Boolean(controlBar.includeInLayout))
  473.          {
  474.             _loc6_ = controlBar.getExplicitOrMeasuredWidth() + _loc4_.left + _loc4_.right;
  475.             measuredWidth = Math.max(measuredWidth,_loc6_);
  476.          }
  477.       }
  478.       
  479.       mx_internal function getControlBar() : IUIComponent
  480.       {
  481.          return controlBar;
  482.       }
  483.       
  484.       override public function get viewMetrics() : EdgeMetrics
  485.       {
  486.          var _loc2_:EdgeMetrics = null;
  487.          var _loc3_:Number = NaN;
  488.          var _loc4_:Number = NaN;
  489.          var _loc5_:Number = NaN;
  490.          var _loc6_:Number = NaN;
  491.          var _loc7_:Number = NaN;
  492.          var _loc8_:Number = NaN;
  493.          var _loc1_:EdgeMetrics = super.viewMetrics;
  494.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  495.          {
  496.             if(!panelViewMetrics)
  497.             {
  498.                panelViewMetrics = new EdgeMetrics(0,0,0,0);
  499.             }
  500.             _loc1_ = panelViewMetrics;
  501.             _loc2_ = super.viewMetrics;
  502.             _loc3_ = getStyle("borderThickness");
  503.             _loc4_ = getStyle("borderThicknessLeft");
  504.             _loc5_ = getStyle("borderThicknessTop");
  505.             _loc6_ = getStyle("borderThicknessRight");
  506.             _loc7_ = getStyle("borderThicknessBottom");
  507.             _loc1_.left = _loc2_.left + (isNaN(_loc4_) ? _loc3_ : _loc4_);
  508.             _loc1_.top = _loc2_.top + (isNaN(_loc5_) ? _loc3_ : _loc5_);
  509.             _loc1_.right = _loc2_.right + (isNaN(_loc6_) ? _loc3_ : _loc6_);
  510.             _loc1_.bottom = _loc2_.bottom + (isNaN(_loc7_) ? (Boolean(controlBar) && !isNaN(_loc5_) ? _loc5_ : (isNaN(_loc4_) ? _loc3_ : _loc4_)) : _loc7_);
  511.             _loc8_ = getHeaderHeight();
  512.             if(!isNaN(_loc8_))
  513.             {
  514.                _loc1_.top += _loc8_;
  515.             }
  516.             if(Boolean(controlBar) && Boolean(controlBar.includeInLayout))
  517.             {
  518.                _loc1_.bottom += controlBar.getExplicitOrMeasuredHeight();
  519.             }
  520.          }
  521.          return _loc1_;
  522.       }
  523.       
  524.       private function measureHeaderText() : Rectangle
  525.       {
  526.          var _loc3_:UITextFormat = null;
  527.          var _loc4_:TextLineMetrics = null;
  528.          var _loc1_:Number = 20;
  529.          var _loc2_:Number = 14;
  530.          if(Boolean(titleTextField) && Boolean(titleTextField.text))
  531.          {
  532.             titleTextField.validateNow();
  533.             _loc3_ = titleTextField.getUITextFormat();
  534.             _loc4_ = _loc3_.measureText(titleTextField.text,false);
  535.             _loc1_ = _loc4_.width;
  536.             _loc2_ = _loc4_.height;
  537.          }
  538.          if(Boolean(statusTextField) && Boolean(statusTextField.text))
  539.          {
  540.             statusTextField.validateNow();
  541.             _loc3_ = statusTextField.getUITextFormat();
  542.             _loc4_ = _loc3_.measureText(statusTextField.text,false);
  543.             _loc1_ = Math.max(_loc1_,_loc4_.width);
  544.             _loc2_ = Math.max(_loc2_,_loc4_.height);
  545.          }
  546.          return new Rectangle(0,0,Math.round(_loc1_),Math.round(_loc2_));
  547.       }
  548.       
  549.       mx_internal function createTitleTextField(param1:int) : void
  550.       {
  551.          var _loc2_:String = null;
  552.          if(!titleTextField)
  553.          {
  554.             titleTextField = IUITextField(createInFontContext(UITextField));
  555.             titleTextField.selectable = false;
  556.             if(param1 == -1)
  557.             {
  558.                titleBar.addChild(DisplayObject(titleTextField));
  559.             }
  560.             else
  561.             {
  562.                titleBar.addChildAt(DisplayObject(titleTextField),param1);
  563.             }
  564.             _loc2_ = getStyle("titleStyleName");
  565.             titleTextField.styleName = _loc2_;
  566.             titleTextField.text = title;
  567.             titleTextField.enabled = enabled;
  568.          }
  569.       }
  570.       
  571.       private function closeButton_clickHandler(param1:MouseEvent) : void
  572.       {
  573.          dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
  574.       }
  575.       
  576.       private function setControlBar(param1:IUIComponent) : void
  577.       {
  578.          if(param1 == controlBar)
  579.          {
  580.             return;
  581.          }
  582.          controlBar = param1;
  583.          if(!checkedForAutoSetRoundedCorners)
  584.          {
  585.             checkedForAutoSetRoundedCorners = true;
  586.             autoSetRoundedCorners = !!styleDeclaration ? styleDeclaration.getStyle("roundedBottomCorners") === undefined : true;
  587.          }
  588.          if(autoSetRoundedCorners)
  589.          {
  590.             setStyle("roundedBottomCorners",controlBar != null);
  591.          }
  592.          var _loc2_:String = getStyle("controlBarStyleName");
  593.          if(Boolean(_loc2_) && controlBar is ISimpleStyleClient)
  594.          {
  595.             ISimpleStyleClient(controlBar).styleName = _loc2_;
  596.          }
  597.          if(controlBar)
  598.          {
  599.             controlBar.enabled = enabled;
  600.          }
  601.          if(controlBar is IAutomationObject)
  602.          {
  603.             IAutomationObject(controlBar).showInAutomationHierarchy = false;
  604.          }
  605.          mx_internal::invalidateViewMetricsAndPadding();
  606.          invalidateSize();
  607.          invalidateDisplayList();
  608.       }
  609.       
  610.       protected function get closeButtonStyleFilters() : Object
  611.       {
  612.          return _closeButtonStyleFilters;
  613.       }
  614.       
  615.       public function set constraintColumns(param1:Array) : void
  616.       {
  617.          var _loc2_:int = 0;
  618.          var _loc3_:int = 0;
  619.          if(param1 != _constraintColumns)
  620.          {
  621.             _loc2_ = int(param1.length);
  622.             _loc3_ = 0;
  623.             while(_loc3_ < _loc2_)
  624.             {
  625.                ConstraintColumn(param1[_loc3_]).container = this;
  626.                _loc3_++;
  627.             }
  628.             _constraintColumns = param1;
  629.             invalidateSize();
  630.             invalidateDisplayList();
  631.          }
  632.       }
  633.       
  634.       override public function set enabled(param1:Boolean) : void
  635.       {
  636.          super.enabled = param1;
  637.          if(titleTextField)
  638.          {
  639.             titleTextField.enabled = param1;
  640.          }
  641.          if(statusTextField)
  642.          {
  643.             statusTextField.enabled = param1;
  644.          }
  645.          if(controlBar)
  646.          {
  647.             controlBar.enabled = param1;
  648.          }
  649.          if(mx_internal::closeButton)
  650.          {
  651.             mx_internal::closeButton.enabled = param1;
  652.          }
  653.       }
  654.       
  655.       override public function get baselinePosition() : Number
  656.       {
  657.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  658.          {
  659.             return super.baselinePosition;
  660.          }
  661.          if(!mx_internal::validateBaselinePosition())
  662.          {
  663.             return NaN;
  664.          }
  665.          return titleBar.y + titleTextField.y + titleTextField.baselinePosition;
  666.       }
  667.       
  668.       protected function stopDragging() : void
  669.       {
  670.          systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  671.          systemManager.removeEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  672.          systemManager.stage.removeEventListener(Event.MOUSE_LEAVE,stage_mouseLeaveHandler);
  673.          regX = NaN;
  674.          regY = NaN;
  675.       }
  676.       
  677.       private function titleBar_mouseDownHandler(param1:MouseEvent) : void
  678.       {
  679.          if(param1.target == mx_internal::closeButton)
  680.          {
  681.             return;
  682.          }
  683.          if(enabled && isPopUp && isNaN(regX))
  684.          {
  685.             startDragging(param1);
  686.          }
  687.       }
  688.       
  689.       override mx_internal function get usePadding() : Boolean
  690.       {
  691.          return layout != ContainerLayout.ABSOLUTE;
  692.       }
  693.       
  694.       override protected function initializeAccessibility() : void
  695.       {
  696.          if(Panel.mx_internal::createAccessibilityImplementation != null)
  697.          {
  698.             Panel.mx_internal::createAccessibilityImplementation(this);
  699.          }
  700.       }
  701.       
  702.       protected function getHeaderHeight() : Number
  703.       {
  704.          var _loc1_:Number = getStyle("headerHeight");
  705.          if(isNaN(_loc1_))
  706.          {
  707.             _loc1_ = measureHeaderText().height + HEADER_PADDING;
  708.          }
  709.          return _loc1_;
  710.       }
  711.       
  712.       public function set constraintRows(param1:Array) : void
  713.       {
  714.          var _loc2_:int = 0;
  715.          var _loc3_:int = 0;
  716.          if(param1 != _constraintRows)
  717.          {
  718.             _loc2_ = int(param1.length);
  719.             _loc3_ = 0;
  720.             while(_loc3_ < _loc2_)
  721.             {
  722.                ConstraintRow(param1[_loc3_]).container = this;
  723.                _loc3_++;
  724.             }
  725.             _constraintRows = param1;
  726.             invalidateSize();
  727.             invalidateDisplayList();
  728.          }
  729.       }
  730.       
  731.       public function set title(param1:String) : void
  732.       {
  733.          _title = param1;
  734.          _titleChanged = true;
  735.          invalidateProperties();
  736.          invalidateSize();
  737.          mx_internal::invalidateViewMetricsAndPadding();
  738.          dispatchEvent(new Event("titleChanged"));
  739.       }
  740.       
  741.       private function showTitleBar(param1:Boolean) : void
  742.       {
  743.          var _loc4_:DisplayObject = null;
  744.          titleBar.visible = param1;
  745.          var _loc2_:int = titleBar.numChildren;
  746.          var _loc3_:int = 0;
  747.          while(_loc3_ < _loc2_)
  748.          {
  749.             _loc4_ = titleBar.getChildAt(_loc3_);
  750.             _loc4_.visible = param1;
  751.             _loc3_++;
  752.          }
  753.       }
  754.       
  755.       override public function styleChanged(param1:String) : void
  756.       {
  757.          var _loc3_:String = null;
  758.          var _loc4_:String = null;
  759.          var _loc5_:String = null;
  760.          var _loc6_:Class = null;
  761.          var _loc7_:IStyleClient = null;
  762.          var _loc8_:ISimpleStyleClient = null;
  763.          var _loc2_:Boolean = !param1 || param1 == "styleName";
  764.          super.styleChanged(param1);
  765.          if(_loc2_ || param1 == "titleStyleName")
  766.          {
  767.             if(titleTextField)
  768.             {
  769.                _loc3_ = getStyle("titleStyleName");
  770.                titleTextField.styleName = _loc3_;
  771.             }
  772.          }
  773.          if(_loc2_ || param1 == "statusStyleName")
  774.          {
  775.             if(statusTextField)
  776.             {
  777.                _loc4_ = getStyle("statusStyleName");
  778.                statusTextField.styleName = _loc4_;
  779.             }
  780.          }
  781.          if(_loc2_ || param1 == "controlBarStyleName")
  782.          {
  783.             if(Boolean(controlBar) && controlBar is ISimpleStyleClient)
  784.             {
  785.                _loc5_ = getStyle("controlBarStyleName");
  786.                ISimpleStyleClient(controlBar).styleName = _loc5_;
  787.             }
  788.          }
  789.          if(_loc2_ || param1 == "titleBackgroundSkin")
  790.          {
  791.             if(titleBar)
  792.             {
  793.                _loc6_ = getStyle("titleBackgroundSkin");
  794.                if(_loc6_)
  795.                {
  796.                   if(mx_internal::titleBarBackground)
  797.                   {
  798.                      titleBar.removeChild(DisplayObject(mx_internal::titleBarBackground));
  799.                      mx_internal::titleBarBackground = null;
  800.                   }
  801.                   mx_internal::titleBarBackground = new _loc6_();
  802.                   _loc7_ = mx_internal::titleBarBackground as IStyleClient;
  803.                   if(_loc7_)
  804.                   {
  805.                      _loc7_.setStyle("backgroundImage",undefined);
  806.                   }
  807.                   _loc8_ = mx_internal::titleBarBackground as ISimpleStyleClient;
  808.                   if(_loc8_)
  809.                   {
  810.                      _loc8_.styleName = this;
  811.                   }
  812.                   titleBar.addChildAt(DisplayObject(mx_internal::titleBarBackground),0);
  813.                }
  814.             }
  815.          }
  816.       }
  817.       
  818.       mx_internal function getStatusTextField() : IUITextField
  819.       {
  820.          return statusTextField;
  821.       }
  822.       
  823.       public function set fontContext(param1:IFlexModuleFactory) : void
  824.       {
  825.          this.moduleFactory = param1;
  826.       }
  827.       
  828.       override protected function commitProperties() : void
  829.       {
  830.          var _loc1_:int = 0;
  831.          super.commitProperties();
  832.          if(hasFontContextChanged())
  833.          {
  834.             if(titleTextField)
  835.             {
  836.                _loc1_ = titleBar.getChildIndex(DisplayObject(titleTextField));
  837.                mx_internal::removeTitleTextField();
  838.                mx_internal::createTitleTextField(_loc1_);
  839.                _titleChanged = true;
  840.             }
  841.             if(statusTextField)
  842.             {
  843.                _loc1_ = titleBar.getChildIndex(DisplayObject(statusTextField));
  844.                mx_internal::removeStatusTextField();
  845.                mx_internal::createStatusTextField(_loc1_);
  846.                _statusChanged = true;
  847.             }
  848.          }
  849.          if(_titleChanged)
  850.          {
  851.             _titleChanged = false;
  852.             titleTextField.text = _title;
  853.             if(initialized)
  854.             {
  855.                layoutChrome(unscaledWidth,unscaledHeight);
  856.             }
  857.          }
  858.          if(_titleIconChanged)
  859.          {
  860.             _titleIconChanged = false;
  861.             if(mx_internal::titleIconObject)
  862.             {
  863.                titleBar.removeChild(DisplayObject(mx_internal::titleIconObject));
  864.                mx_internal::titleIconObject = null;
  865.             }
  866.             if(_titleIcon)
  867.             {
  868.                mx_internal::titleIconObject = new _titleIcon();
  869.                titleBar.addChild(DisplayObject(mx_internal::titleIconObject));
  870.             }
  871.             if(initialized)
  872.             {
  873.                layoutChrome(unscaledWidth,unscaledHeight);
  874.             }
  875.          }
  876.          if(_statusChanged)
  877.          {
  878.             _statusChanged = false;
  879.             statusTextField.text = _status;
  880.             if(initialized)
  881.             {
  882.                layoutChrome(unscaledWidth,unscaledHeight);
  883.             }
  884.          }
  885.       }
  886.       
  887.       protected function startDragging(param1:MouseEvent) : void
  888.       {
  889.          regX = param1.stageX - x;
  890.          regY = param1.stageY - y;
  891.          systemManager.addEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  892.          systemManager.addEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  893.          systemManager.stage.addEventListener(Event.MOUSE_LEAVE,stage_mouseLeaveHandler);
  894.       }
  895.       
  896.       mx_internal function removeStatusTextField() : void
  897.       {
  898.          if(Boolean(titleBar) && Boolean(statusTextField))
  899.          {
  900.             titleBar.removeChild(DisplayObject(statusTextField));
  901.             statusTextField = null;
  902.          }
  903.       }
  904.       
  905.       private function stage_mouseLeaveHandler(param1:Event) : void
  906.       {
  907.          if(!isNaN(regX))
  908.          {
  909.             stopDragging();
  910.          }
  911.       }
  912.       
  913.       public function set status(param1:String) : void
  914.       {
  915.          _status = param1;
  916.          _statusChanged = true;
  917.          invalidateProperties();
  918.          dispatchEvent(new Event("statusChanged"));
  919.       }
  920.       
  921.       [Bindable("titleIconChanged")]
  922.       public function get titleIcon() : Class
  923.       {
  924.          return _titleIcon;
  925.       }
  926.       
  927.       [Bindable("statusChanged")]
  928.       public function get status() : String
  929.       {
  930.          return _status;
  931.       }
  932.       
  933.       private function systemManager_mouseMoveHandler(param1:MouseEvent) : void
  934.       {
  935.          param1.stopImmediatePropagation();
  936.          move(param1.stageX - regX,param1.stageY - regY);
  937.       }
  938.       
  939.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  940.       {
  941.          super.updateDisplayList(param1,param2);
  942.          layoutObject.updateDisplayList(param1,param2);
  943.          if(mx_internal::border)
  944.          {
  945.             mx_internal::border.visible = true;
  946.          }
  947.          titleBar.visible = true;
  948.       }
  949.       
  950.       mx_internal function removeTitleTextField() : void
  951.       {
  952.          if(Boolean(titleBar) && Boolean(titleTextField))
  953.          {
  954.             titleBar.removeChild(DisplayObject(titleTextField));
  955.             titleTextField = null;
  956.          }
  957.       }
  958.       
  959.       public function set titleIcon(param1:Class) : void
  960.       {
  961.          _titleIcon = param1;
  962.          _titleIconChanged = true;
  963.          invalidateProperties();
  964.          invalidateSize();
  965.          dispatchEvent(new Event("titleIconChanged"));
  966.       }
  967.    }
  968. }
  969.  
  970.